package test;

import java.util.Objects;

public class Clone implements Cloneable{
    private String username;
    private String password;

    public Clone(String username, String password) {
        this.username = username;
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    @Override
    public boolean equals(Object o) {
        Clone clone = (Clone) o;
        if (this.username.equals(clone.username) && this.password.equals(clone.password)){
            return true;
        }
        return false;
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Clone c1 = new Clone("haha","123456");
        Clone c2 = (Clone) c1.clone();
        Clone c3 = c1;
        System.out.println(c1.equals(c2));
        System.out.println(c1 == c2);
        System.out.println(c1 == c3);
        System.out.println(c2 == c3);
        System.out.println(c1.equals(c3));
    }

}
